//
//  UserInformationView.m
//  FlowerRainGround
//
//  Created by lanou on 16/4/20.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "UserInformationView.h"

@implementation UserInformationView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        //改变头像的label
        self.changeImageLabel = [[UILabel alloc] initWithFrame:CGRectMake(35, 10, kWidth - 45 , 50)];
        self.changeImageLabel.text = @"         更换头像";
        self.changeImageLabel.backgroundColor = [UIColor grayColor];
        [self addSubview:self.changeImageLabel];
        
        //头像
        self.headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 50, 50)];
        self.headImageView.layer.cornerRadius = 25;
        self.headImageView.layer.masksToBounds = YES;
        self.headImageView.image = [userManager getUsrHeadImage];
        self.headImageView.backgroundColor = [UIColor redColor];
        [self addSubview:self.headImageView];
        
        //昵称lable
        self.namelabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 70, kWidth - 20, 50)];
        self.namelabel.text = @"  昵称";
        self.namelabel.backgroundColor = [UIColor grayColor];
        [self addSubview:self.namelabel];
        
        //输入昵称的textfield
        self.nameTextField = [[UITextField alloc] initWithFrame:CGRectMake(60, 70, kWidth - 70, 50)];
        self.nameTextField.backgroundColor = [UIColor grayColor];
        self.nameTextField.placeholder = [userManager getUsrName];//获取用户名
        self.nameTextField.borderStyle = UITextBorderStyleNone;
        [self addSubview:self.nameTextField];
        
        //genderlabel
        self.genderLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 130, kWidth - 20, 50)];
        self.genderLabel.text = @"  性别";
        self.genderLabel.backgroundColor = [UIColor grayColor];
        [self addSubview:self.genderLabel];
        
        //选择性别， 添加轻拍方法
        self.changeGenderLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 130, kWidth - 70, 50)];
        self.changeGenderLabel.backgroundColor = [UIColor grayColor];
        self.changeGenderLabel.text = [userManager getUsrGender];
        [self addSubview:self.changeGenderLabel];
        
        //生日
        self.birthday = [[UILabel alloc] initWithFrame:CGRectMake(10, 190, kWidth - 20, 50)];
        self.birthday.text = @"  出生年月";
        self.birthday.backgroundColor = [UIColor grayColor];
        [self addSubview:self.birthday];
        
        //选择生日
        self.ChooseBirthday = [[UILabel alloc] initWithFrame:CGRectMake(100, 190, kWidth - 110, 50)];
        self.ChooseBirthday.backgroundColor = [UIColor grayColor];
        self.ChooseBirthday.text = [userManager getUsrBirthday];
        [self addSubview:self.ChooseBirthday];
        
        //签名
        self.view = [[UIView alloc] initWithFrame:CGRectMake(10, 250, kWidth - 20, 100)];
        self.view.backgroundColor =  [UIColor grayColor];
        [self addSubview:self.view];
        
        self.personlLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 10,  80, 30)];
        self.personlLabel.backgroundColor = [UIColor grayColor];
        self.personlLabel.text = @"  个人签名";
        [self.view addSubview:self.personlLabel];
        self.PersonalSignatureTextView = [[UITextView alloc] initWithFrame:CGRectMake(80, 10, kWidth - 110, 90)];
        self.PersonalSignatureTextView.backgroundColor = [UIColor grayColor];
        self.PersonalSignatureTextView.text = [userManager getuserPersonalSignature];
        [self.view addSubview:self.PersonalSignatureTextView];

    }
    return self;
}


//点击回收键盘
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//    [self.nameTextField resignFirstResponder];
    [self endEditing:YES];
}








/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
